home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / extras / programm / gemfsc20 / gemfsc20.lzh / GNUGEM27 / AESWIN.C < prev    next >
C/C++ Source or Header  |  1993-03-24  |  6KB  |  278 lines

  1. /*
  2.  *    Aes window library interface
  3.  *
  4.  *        wind_create     Create a window
  5.  *        wind_open        Open a window in its initial size
  6.  *        wind_close        Close a window (not de-allocated)
  7.  *        wind_delete     De-Allocate a window
  8.  *        wind_get        Returns info about a window
  9.  *        wind_set        Sets various attributes of a window
  10.  *        wind_find        Find window under mouse.
  11.  *        wind_update     Advise AES about exclusive use of a window
  12.  *        wind_calc        Calc work area/border area of a window
  13.  *        wind_new        close and delete all windows
  14.  *
  15.  *        ++jrb    bammi@cadence.com
  16.  *        modified: mj -- ntomczak@vm.ucs.ualberta.ca
  17.  */
  18. #include "common.h"
  19.  
  20. #ifdef __DEF_ALL__
  21.  
  22. #define L_wind_cre
  23. #define L_wind_ope
  24. #define L_wind_clo
  25. #define L_wind_del
  26. #define L_wind_get
  27. #define L_wind_set
  28. #define L_wind_fin
  29. #define L_wind_upd
  30. #define L_wind_cal
  31. #define L_wind_new
  32.  
  33. #endif /* __DEF_ALL__ */
  34.  
  35.  
  36. #ifdef L_wind_cre
  37.  
  38. /* wind_create
  39.  *    Parts    The window parts to be present
  40.  *        NAME    0x0001    Title Bar
  41.  *        CLOSE    0x0002    Close Box
  42.  *        FULL    0x0004    Full Box
  43.  *        MOVE    0x0008    Move Bar
  44.  *        INFO    0x0010    Info line
  45.  *        SIZE    0x0020    Size Box
  46.  *        UPARROW 0x0040    Up arrow on vert slider
  47.  *        DNARROW 0x0080    Dn arrow on vert slider
  48.  *        VSLIDE    0x0100    Vert slider
  49.  *        LFARROW 0x0200    Left  arrow on horz slider
  50.  *        RTARROW 0x0400    Right arrow on horz slider
  51.  *        HSLIDE    0x0800    Horz slider
  52.  *
  53.  *    Wx,Wy,Ww,Wh Max window size
  54.  *
  55.  *    retrun    WindowHandle    Identifier of the created window <0 == error
  56.  */
  57. int wind_create(int Parts, int Wx, int Wy, int Ww, int Wh)
  58. {
  59.     _int_in[0] = Parts;
  60.     _int_in[1] = Wx;
  61.     _int_in[2] = Wy;
  62.     _int_in[3] = Ww;
  63.     _int_in[4] = Wh;
  64.  
  65.     return __aes__(AES_CONTROL_ENCODE(100, 5, 1, 0));
  66. }
  67. #endif /* L_wind_cre */
  68.  
  69.  
  70. #ifdef L_wind_ope
  71.  
  72. /* wind_open
  73.  *    WindowHandle    The window's identifying handle
  74.  *    Wx,Wy,Ww,Wh Position and size to open at
  75.  *
  76.  *    returns 0 on error    >0 no error
  77.  */
  78. int wind_open(int WindowHandle, int Wx, int Wy, int Ww, int Wh)
  79. {
  80.     _int_in[0] = WindowHandle;
  81.     _int_in[1] = Wx;
  82.     _int_in[2] = Wy;
  83.     _int_in[3] = Ww;
  84.     _int_in[4] = Wh;
  85.  
  86.     return __aes__(AES_CONTROL_ENCODE(101, 5, 1, 0));
  87. }
  88. #endif /* L_wind_ope */
  89.  
  90.  
  91. #ifdef L_wind_clo
  92.  
  93. int wind_close(int WindowHandle)
  94. {
  95.     _int_in[0] = WindowHandle;
  96.     return __aes__(AES_CONTROL_ENCODE(102, 1, 1, 0));
  97. }
  98. #endif /* L_wind_clo */
  99.  
  100.  
  101. #ifdef L_wind_del
  102.  
  103. int wind_delete(int WindowHandle)
  104. {
  105.     _int_in[0] = WindowHandle;
  106.     return __aes__(AES_CONTROL_ENCODE(103, 1, 1, 0));
  107. }
  108. #endif /* L_wind_del */
  109.  
  110. #ifdef L_wind_get
  111.  
  112. /*
  113.  * wind_get
  114.  *    WindowHandle    Window identifier
  115.  *    What        WF_WORKXYWH(4)    coordinates of inside work area
  116.  *            WF_CURRXYWH(5)    curr coordinates of entire window
  117.  *            WF_PREVXYWH(6)    coordinates of previous window
  118.  *            WF_FULLXYWH(7)    coordinate of window at its max size
  119.  *            WF_HSLIDE(8)    position of horz slider in W1
  120.  *            WF_VSLIDE(9)    position of vert slider in W1
  121.  *            WF_TOP(10)    window handle of window on top in W1
  122.  *            WF_FIRSTXYWH(11) coord. of first rect in window list
  123.  *            WF_NEXTXYWH(12) coord. of next window in rect in list
  124.  *            13,14 reserved
  125.  *            WF_HSLSIZE(15)    size of horz slider in W1
  126.  *            WF_VSLSIZE(16)    size of vert slider in W1
  127.  *
  128.  *    retrns 0 on error    >0 no error
  129.  */
  130. int wind_get(int WindowHandle, int What,
  131.          int *W1, int *W2, int *W3, int *W4)
  132. {
  133.     int retval;
  134.  
  135.     _int_in[0] = WindowHandle;
  136.     _int_in[1] = What;
  137.  
  138.     retval = __aes__(AES_CONTROL_ENCODE(104, 2, 5, 0));
  139.  
  140.     *W1 = _int_out[1];
  141.     *W2 = _int_out[2];
  142.     *W3 = _int_out[3];
  143.     *W4 = _int_out[4];
  144.  
  145.     return retval;
  146. }
  147. #endif /* L_wind_get */
  148.  
  149. #ifdef L_wind_set
  150.  
  151. /*
  152.  * wind_set     (See wind_set_address below too)
  153.  *    What        Same as above except
  154.  *            WF_KIND(1)    Window components in W1
  155.  *            WF_NAME(2)    Window Title in W1 and W2
  156.  *            WF_INFO(3)    Window info line in W1 and W2
  157.  *            WF_NEWDESK(14)    Address of new desktop tree in W1 W2
  158.  *                    index of object in W3
  159.  *
  160.  *    return 0 on error    >0 no error
  161.  */
  162. int wind_set(int WindowHandle, int What, int W1, int W2, int W3, int W4)
  163. {
  164.     _int_in[0] = WindowHandle;
  165.     _int_in[1] = What;
  166. #ifdef __MSHORT__
  167.     _int_in[2] = W1;
  168.     _int_in[3] = W2;
  169.     _int_in[4] = W3;
  170.     _int_in[5] = W4;
  171. #else
  172.     /* for 32 bit ints stuff the address into _int_in[2] and [3] */
  173.     switch(What)
  174.     {
  175.      /* NAME    INFO    NEWDESK */
  176.     case 2: case 3: case 14:
  177.         { unsigned short *s = (unsigned short *)&W1;
  178.           _int_in[2] = s[0];
  179.           _int_in[3] = s[1];
  180.           if(What == 14 /* NEWDESK */)
  181.             _int_in[4] = W2;
  182.         }
  183.         break;
  184.     default:
  185.         _int_in[2] = W1;
  186.         _int_in[3] = W2;
  187.         _int_in[4] = W3;
  188.         _int_in[5] = W4;
  189.     }
  190. #endif /* __MSHORT__ */
  191.  
  192.     return __aes__(AES_CONTROL_ENCODE(105, 6, 1, 0));
  193. }
  194. #endif /* L_wind_set */
  195.  
  196. #ifdef L_wind_fin
  197.  
  198. /*    Find window under mouse
  199.  *    returns handle of window undex X,Y
  200.  */
  201. int wind_find(int X, int Y)
  202. {
  203.     _int_in[0] = X;
  204.     _int_in[1] = Y;
  205.     return __aes__(AES_CONTROL_ENCODE(106, 2, 1, 0));
  206. }
  207. #endif /* L_wind_fin */
  208.  
  209. #ifdef L_wind_upd
  210.  
  211. /* wind_update
  212.  *    Code    END_UPDATE(0)    end of update
  213.  *        BEG_UPDATE(1)    begin update of window
  214.  *        END_MCTRL(2)    end control of mouse functions
  215.  *        BEG_MCTRL(3)    begin control of mouse functions
  216.  *
  217.  *    returns 0 on error    >0 no error
  218.  */
  219. int wind_update(int Code)
  220. {
  221.     _int_in[0] = Code;
  222.     return __aes__(AES_CONTROL_ENCODE(107, 1, 1, 0));
  223. }
  224. #endif /* L_wind_upd */
  225.  
  226. #ifdef L_wind_cal
  227.  
  228. /*
  229.  * wind_calc
  230.  *    Type    = 0 return border area
  231.  *        = 1 return inner work area
  232.  *    Parts    As above
  233.  *    InX,InY, InW, InH input value, when Type = 0 coord. of inner area
  234.  *                           when Type = 1 coord. of border area
  235.  *    OutX,OutY,OutW, OutH    calculated coordinates
  236.  *
  237.  *    return 0 on error    >0 o error
  238.  */
  239. int wind_calc(int Type, int Parts,
  240.           int InX,    int InY, int InW, int InH,
  241.           int *OutX, int *OutY, int *OutW, int *OutH)
  242. {
  243.     int retval;
  244.  
  245.     _int_in[0] = Type;
  246.     _int_in[1] = Parts;
  247.     _int_in[2] = InX;
  248.     _int_in[3] = InY;
  249.     _int_in[4] = InW;
  250.     _int_in[5] = InH;
  251.  
  252.     retval = __aes__(AES_CONTROL_ENCODE(108, 6, 5, 0));
  253.  
  254.     *OutX = _int_out[1];
  255.     *OutY = _int_out[2];
  256.     *OutW = _int_out[3];
  257.     *OutH = _int_out[4];
  258.  
  259.     return retval;
  260. }
  261. #endif /* L_wind_cal */
  262.  
  263. #ifdef L_wind_new
  264.  
  265. /*
  266.  * wind_new
  267.  *    Close and delete all windows, reset wind_update(), flush all buffers
  268.  *    restore mouse ownership to system
  269.  *
  270.  */
  271. void wind_new(void)
  272. {
  273.     (void) __aes__(AES_CONTROL_ENCODE(109, 0, 0, 0));
  274. }
  275. #endif /* L_wind_new */
  276.  
  277. /* - eof - */
  278.